package logic

import (
	"context"
	"novel-world/model/mysql"

	"novel-world/novelrpc/internal/svc"
	"novel-world/novelrpc/novelrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type BooksListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewBooksListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BooksListLogic {
	return &BooksListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *BooksListLogic) BooksList(in *novelrpc.BooksListRequest) (*novelrpc.BooksListResponse, error) {
	// todo: add your logic here and delete this line
	var user mysql.Books
	var lists []*novelrpc.GetList1
	var err error
	lists, err = user.BooksList(mysql.DB, lists, in)
	if err != nil {
		return nil, err
	}
	return &novelrpc.BooksListResponse{
		Lists: lists,
	}, nil
}
